from pydantic import BaseModel, Field
from typing import Optional

class EquipmentTypeBase(BaseModel):
    equipmentTypeName: str = Field(..., description="设备类型名称")
    isMust: bool = Field(..., description="是否必须设备类型")
    isSingle: bool = Field(..., description="是否只能设置一个")
    icon: Optional[str] = Field(None, description="显示ICON")
    modelUrl: Optional[str] = Field(None, description="模型链接")
    parentId: Optional[str] = Field(None, description="父设备类型ID")
    level: int = Field(..., description="层级深度")

class EquipmentTypeCreate(EquipmentTypeBase):
    equipmentTypeId: str = Field(..., description="设备类型ID")

class EquipmentTypeUpdate(BaseModel):
    equipmentTypeName: Optional[str] = None
    isMust: Optional[bool] = None
    isSingle: Optional[bool] = None
    icon: Optional[str] = None
    modelUrl: Optional[str] = None
    parentId: Optional[str] = None
    level: Optional[int] = None

class EquipmentTypeDetail(EquipmentTypeBase):
    equipmentTypeId: str
    createdBy: Optional[str] = Field(None, description="创建人(后端自动生成)")
    createdAt: Optional[str] = Field(None, description="创建时间(后端自动生成)")
    updatedBy: Optional[str] = Field(None, description="更新人(后端自动生成)")
    updatedAt: Optional[str] = Field(None, description="更新时间(后端自动生成)") 